package com.smart.entity;

import lombok.Data;
import java.util.Date;
import java.io.Serializable;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import cn.hutool.core.date.DatePattern;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.SqlCondition;

/**
 * @author lgb
 * @date 2020年6月9日 上午11:19:21
 * Copyright (C) 深圳工勘科技
 * @说明: 后台用户登录日志表
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_user_login_log")
public class SysUserLoginLog implements Serializable{

	private static final long serialVersionUID = -4076973286504401653L;
	
	@TableId
    private Long id;

    @ApiModelProperty(value = "key")
    private String keyword;
    
    /** 用户ID */
    private Long userId;
    
    /** 用户名 */
    @ApiModelProperty(value = "用户名")
    @TableField(condition = SqlCondition.LIKE)
    private String username;
    
    /** 用户昵称 */
    @ApiModelProperty(value = "用户昵称")
    private String nickName;

    /** 登陆IP */
    @ApiModelProperty(value = "登陆IP")
    private String ip;
    
    /** 登陆地点 */
    @ApiModelProperty(value = "登陆地点")
    @TableField(condition = SqlCondition.LIKE)
    private String address;
    
    /** 浏览器登录类型 */
    @ApiModelProperty(value = "浏览器登录类型")
    private String userAgent;
    
    /** 创建时间 */
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
    private Date createTime;
    
    /** 修改时间 */
    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
    private Date modifyTime;
    /**
     * 有效状态：0->无效；1->有效
     */
    @ApiModelProperty(value = "有效状态：0->无效；1->有效")
    @TableLogic
    private Integer valid;

    /** 开始时间 */
    @JsonIgnore
    @TableField(exist = false)
    private String beginTime;

    /** 结束时间 */
    @JsonIgnore
    @TableField(exist = false)
    private String endTime;

    public SysUserLoginLog(String keyword,Long userId,String un,
    		String nickName,String ip,String address,String userAgent, 
    		Date createTime,Date modifyTime) {
        this.keyword = keyword;
        this.userId = userId;
        this.username = un;
        this.nickName = nickName;
        this.ip = ip;
        this.address = address;
        this.userAgent = userAgent;
        this.createTime = createTime;
        this.modifyTime = modifyTime;
    }
    
}